#include <Arduino.h>
#include "Servo/Servo.h"
#include "servoMotor.h"

servoMotor::servoMotor(){
	_pin = NULL;

}

servoMotor::servoMotor(int pin){
	_pin = pin;
	servomotor.attach(_pin);
}

void servoMotor::inicializarServo(int pin) {
	_pin = pin;
	servomotor.attach(_pin);
	servomotor.write(90);
}

void servoMotor::escribirServomotor(int angulo){
	servomotor.write(angulo);
}

int servoMotor::getPin() const {
	return _pin;
}

void servoMotor::setPin(int pin) {
	_pin = pin;
}

const Servo& servoMotor::getServomotorUs() const {
	return servomotor;
}

void servoMotor::setServomotorUs(const Servo& servomotorUs) {
	servomotor = servomotorUs;
}

servoMotor::~servoMotor() {
	_pin = NULL;
	servomotor.detach();
}
